package com.chen.winnerframework.domain.dto.user;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.hutool.core.bean.BeanUtil;
import com.chen.winnerframework.domain.entity.mybatis.rbac.User;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.*;
import java.util.List;

/**
 * 用户 数据传输对象
 *
 * @author chengy
 * @date 2022/11/25
 */
public class UserDto {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Excel(name = "用户名", width = 20)
    @ApiModelProperty(value = "用户名", required = true)
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Excel(name = "密码", width = 20)
    @ApiModelProperty(value = "密码", required = true)
    private String password;

    /**
     * 名称
     */
    @NotBlank(message = "名称不能为空")
    @Excel(name = "名称", width = 20)
    @ApiModelProperty(value = "名称", required = true)
    private String name;

    /**
     * 邮箱
     */
    @Email(message = "邮箱格式有误")
    @Excel(name = "邮箱", width = 20)
    @ApiModelProperty("邮箱")
    private String email;

    /**
     * 手机号
     */
    @ApiModelProperty("手机号")
    @Excel(name = "手机号", width = 20)
    private String phoneNumber;

    /**
     * 性别（1男 0女）
     */
    @ApiModelProperty("性别（1男 0女）")
    @Excel(name = "性别", width = 20, replace = {"男_1", "女_0"})
    private Integer sex;

    /**
     * 备注
     */
    @ApiModelProperty("备注")
    @Excel(name = "备注", width = 20)
    private String remark;

    /**
     * 状态（0禁用 1启用）
     */
    @NotNull(message = "状态不能为空")
    @Excel(name = "状态", width = 20, replace = {"启用_1", "禁用_0"})
    @ApiModelProperty(value = "状态", required = true)
    private Integer status;

    /**
     * 角色id集合
     */
    @ApiModelProperty("角色id集合")
    private List<Integer> roleIds;

    /**
     * 角色名称
     */
    @Excel(name = "角色名称")
    @ApiModelProperty("角色名称")
    private String roleName;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public List<Integer> getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(List<Integer> roleIds) {
        this.roleIds = roleIds;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public User toDo() {
        return BeanUtil.toBean(this, User.class);
    }

}
